package com.ruoyi.model.service.impl;

import java.util.List;

import cn.hutool.core.util.IdUtil;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.model.domain.vo.ModelPlanAlgorithmVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.model.mapper.ModelPlanAlgorithmMapper;
import com.ruoyi.model.domain.ModelPlanAlgorithm;
import com.ruoyi.model.service.IModelPlanAlgorithmService;

/**
 * 方案算法Service业务层处理
 *
 * @author rww
 * @date 2024-11-25
 */
@Service
public class ModelPlanAlgorithmServiceImpl implements IModelPlanAlgorithmService
{
    @Autowired
    private ModelPlanAlgorithmMapper modelPlanAlgorithmMapper;

    /**
     * 查询方案算法
     *
     * @param id 方案算法主键
     * @return 方案算法
     */
    @Override
    public ModelPlanAlgorithm selectModelPlanAlgorithmById(Long id)
    {
        return modelPlanAlgorithmMapper.selectModelPlanAlgorithmById(id);
    }

    /**
     * 查询方案算法列表
     *
     * @param modelPlanAlgorithm 方案算法
     * @return 方案算法
     */
    @Override
    public List<ModelPlanAlgorithmVo> selectModelPlanAlgorithmList(ModelPlanAlgorithm modelPlanAlgorithm)
    {
        return modelPlanAlgorithmMapper.selectModelPlanAlgorithmList(modelPlanAlgorithm);
    }

    /**
     * 新增方案算法
     *
     * @param modelPlanAlgorithm 方案算法
     * @return 结果
     */
    @Override
    public int insertModelPlanAlgorithm(ModelPlanAlgorithm modelPlanAlgorithm)
    {
        modelPlanAlgorithm.setId(IdUtil.getSnowflakeNextId());
        modelPlanAlgorithm.setCreateTime(DateUtils.getNowDate());
        return modelPlanAlgorithmMapper.insertModelPlanAlgorithm(modelPlanAlgorithm);
    }

    /**
     * 修改方案算法
     *
     * @param modelPlanAlgorithm 方案算法
     * @return 结果
     */
    @Override
    public int updateModelPlanAlgorithm(ModelPlanAlgorithm modelPlanAlgorithm)
    {
        modelPlanAlgorithm.setUpdateTime(DateUtils.getNowDate());
        return modelPlanAlgorithmMapper.updateModelPlanAlgorithm(modelPlanAlgorithm);
    }

    /**
     * 批量删除方案算法
     *
     * @param ids 需要删除的方案算法主键
     * @return 结果
     */
    @Override
    public int deleteModelPlanAlgorithmByIds(Long[] ids)
    {
        return modelPlanAlgorithmMapper.deleteModelPlanAlgorithmByIds(ids);
    }

    /**
     * 删除方案算法信息
     *
     * @param id 方案算法主键
     * @return 结果
     */
    @Override
    public int deleteModelPlanAlgorithmById(Long id)
    {
        return modelPlanAlgorithmMapper.deleteModelPlanAlgorithmById(id);
    }
}
